package cn.wizzer.app.user.modules.models;

import cn.wizzer.framework.base.model.BaseModel;
import lombok.Data;
import org.nutz.dao.entity.annotation.*;
import org.nutz.dao.interceptor.annotation.PrevInsert;

import java.io.Serializable;
import java.math.BigDecimal;

@Data
@Table("goods")
public class Goods extends BaseModel implements Serializable {

    @Column
    @Name
    @Comment("ID")
    @ColDefine(type = ColType.VARCHAR, width = 32)
    @PrevInsert(els = {@EL("uuid()")})
    private String id;

    @Column
    @Comment("名称")
    @ColDefine(type = ColType.VARCHAR, width = 128)
    private String name;

    @Column("price")
    @Comment("价格")
    @ColDefine(type = ColType.FLOAT, width = 16, precision = 6)
    private BigDecimal price;

    @Column("stock")
    @Comment("库存")
    @ColDefine(type = ColType.INT)
    private int stock;


    @Column("cover_pic")
    @Comment("封面图")
    @ColDefine(type = ColType.VARCHAR, width = 50)
    private String coverPic;

    @Column("goods_category")
    @Comment("类别")
    @ColDefine(type = ColType.VARCHAR, width = 32)
    private String goodsCategory;

    @Column
    @Comment("详情富文本")
    @ColDefine(type = ColType.TEXT)
    private String content;

    @Column
    @Comment("是否禁用")
    @ColDefine(type = ColType.BOOLEAN)
    private boolean disabled;

    @Column(version = true)
    @Comment("乐观锁version")
    private long version;

}
